<template>
  <el-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialog" title="表单权限控件列表" width="800px">
    <!--表格渲染-->
    <el-table v-loading="loading" :data="privFieldList" size="small" style="width: 100%;">
      <el-table-column :show-overflow-tooltip="true" type="index" width="50"/>
      <el-table-column prop="fieldName" label="控件名">
        <template slot-scope="scope">
          <a title="设置权限" @click="toPrivSet(scope.row)">{{ scope.row.fieldName }}</a>
        </template>
      </el-table-column>
      <el-table-column prop="fieldControlId" label="控件ID"/>
      <el-table-column prop="requireFlag" label="是否必填"/>
      <el-table-column prop="privFlag" label="是否设定权限"/>
    </el-table>
    <privSet ref="privSet" :sup_this="sup_this" />
  </el-dialog>
</template>

<script>
import privSet from './privSet'
import { getFeildDetailInfo } from '@/api/system/formSet'

export default {
  components: { privSet },
  props: {
    sup_this: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      loading: false,
      dialog: false,
      privFieldList: []
    }
  },
  created() {
  },
  methods: {
    loadFieldPrivData(mainId) {
      // 处理模块数据
      getFeildDetailInfo(mainId).then(res => {
        this.privFieldList = res.data
      })
    },
    toPrivSet(fieldVO) {
      const _this = this.$refs.privSet
      _this.initDataOfBefore(fieldVO)
    }
  }
}
</script>

<style scoped>
</style>
